import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/app/HttpRequest.dart';
import 'package:flutter_ahj_app/app/sh/SHListView.dart';
import 'package:flutter_ahj_app/app/sh/SHViewModel.dart';
import 'package:flutter_ahj_app/base/basewidget/view/BaseWidget.dart';
import 'package:flutter_ahj_app/base/basewidget/viewmodel/ViewModelProvider.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JText.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';
import 'package:flutter_ahj_app/base/values/SQColor.dart';
import 'package:flutter_ahj_app/base/values/dimens.dart';

class SHHomeView extends BaseStatefulWidget {
  @override
  State<StatefulWidget> initState() {
    // TODO: implement initState
    // throw UnimplementedError();
    return SHHomeViewState();
  }
}

class SHHomeViewState extends State<SHHomeView> with TickerProviderStateMixin {
  TabController _tabCtr;
  var _scaffoldkey = new GlobalKey<ScaffoldState>();
  var _data;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      key: _scaffoldkey,
      drawer: Drawer(
        child: JText('data'),
      ),
      appBar: MTopBar(
          leading: InkWell(
              onTap: () {
                _scaffoldkey.currentState.openDrawer();
              },
              child: Row(
                children: [
                  Container(
                    width: 10,
                  ),
                ],
              )),
          elevation: 0,
          title: '我的',).create(),
      body: Container(),
    );
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabCtr = TabController(
      length: 3,
      vsync: this,
    );
    Future.delayed(Duration.zero, () {
      _getData();
    });
  }

  _getData() {
    HttpRequest.userInfoRequest().listen((result) {
      setState(() {
        _data = result;
      });
    }, onError: (e) {});
  }

}
